<template>
  <div>
    <el-form ref="form" :model="emp" label-width="80px">
      <el-form-item label="姓名">
        <el-input v-model="emp.name" placeholder="请输入用户名"></el-input>
      </el-form-item>
      <el-form-item label="年龄">
        <el-input v-model="emp.age" placeholder="请输入年龄"></el-input>
      </el-form-item>
      <el-form-item label="生日">
        <el-date-picker v-model="emp.bir"
                        type="date"
                        placeholder="请选择日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="简介">
        <el-input v-model="emp.content" type="textarea" :autosize="{ minRows: 3, maxRows: 6}"></el-input>
      </el-form-item>
      <el-form-item label="地址">
        <el-input v-model="emp.address" placeholder="请输入地址"></el-input>
      </el-form-item>
      <el-form-item align="left">
        <el-button type="primary" @click="addEmp">添加</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
    export default {
        name: "addEmp",
      data(){
          return {
            emp:{}
          }
      },
      methods:{
          addEmp(){
            this.axios({
              url:"/emps",
              method:"POST",
              data:this.emp
            }).then(
              (resp)=>{
                this.$router.push("/empList");
              }
            );
          }
      }
    }
</script>

<style scoped>

</style>
